package main

import (
	"fmt"
	"runtime"
)

func main() {


	go test()



	for true  {

	}

}


func test(){

	defer func() {
		fmt.Println("test exit")
		err	:= recover()
		fmt.Println("err == " ,err)
	}()

	//Goexit终止调用它的go程。其它go程不会受影响。Goexit会在终止该go程前执行所有defer的函数。
	runtime.Goexit()

	fmt.Println("exec test ..........")
}